# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.NetworkServices.V1.Model.HttpRouteRouteMatch do
  @moduledoc """
  RouteMatch defines specifications used to match requests. If multiple match types are set, this RouteMatch will match if ALL type of matches are matched.

  ## Attributes

  *   `fullPathMatch` (*type:* `String.t`, *default:* `nil`) - The HTTP request path value should exactly match this value. Only one of full_path_match, prefix_match, or regex_match should be used.
  *   `headers` (*type:* `list(GoogleApi.NetworkServices.V1.Model.HttpRouteHeaderMatch.t)`, *default:* `nil`) - Specifies a list of HTTP request headers to match against. ALL of the supplied headers must be matched.
  *   `ignoreCase` (*type:* `boolean()`, *default:* `nil`) - Specifies if prefix_match and full_path_match matches are case sensitive. The default value is false.
  *   `prefixMatch` (*type:* `String.t`, *default:* `nil`) - The HTTP request path value must begin with specified prefix_match. prefix_match must begin with a /. Only one of full_path_match, prefix_match, or regex_match should be used.
  *   `queryParameters` (*type:* `list(GoogleApi.NetworkServices.V1.Model.HttpRouteQueryParameterMatch.t)`, *default:* `nil`) - Specifies a list of query parameters to match against. ALL of the query parameters must be matched.
  *   `regexMatch` (*type:* `String.t`, *default:* `nil`) - The HTTP request path value must satisfy the regular expression specified by regex_match after removing any query parameters and anchor supplied with the original URL. For regular expression grammar, please see https://github.com/google/re2/wiki/Syntax Only one of full_path_match, prefix_match, or regex_match should be used.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :fullPathMatch => String.t() | nil,
          :headers => list(GoogleApi.NetworkServices.V1.Model.HttpRouteHeaderMatch.t()) | nil,
          :ignoreCase => boolean() | nil,
          :prefixMatch => String.t() | nil,
          :queryParameters =>
            list(GoogleApi.NetworkServices.V1.Model.HttpRouteQueryParameterMatch.t()) | nil,
          :regexMatch => String.t() | nil
        }

  field(:fullPathMatch)
  field(:headers, as: GoogleApi.NetworkServices.V1.Model.HttpRouteHeaderMatch, type: :list)
  field(:ignoreCase)
  field(:prefixMatch)

  field(:queryParameters,
    as: GoogleApi.NetworkServices.V1.Model.HttpRouteQueryParameterMatch,
    type: :list
  )

  field(:regexMatch)
end

defimpl Poison.Decoder, for: GoogleApi.NetworkServices.V1.Model.HttpRouteRouteMatch do
  def decode(value, options) do
    GoogleApi.NetworkServices.V1.Model.HttpRouteRouteMatch.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.NetworkServices.V1.Model.HttpRouteRouteMatch do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
